<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html><html lang="en">
	<head>
		<!--加载header文件-->
		<?php
		include_once 'public/views/header.php';
		?>
		<link rel="stylesheet" href="public/css/list.css" />
		<link rel="stylesheet" href="public/xr/xrDatatable.css" />
	</head>
	<script>
		function upload(){
			var fileObj = document.getElementById("document-file").files[0]; // js 获取文件对象
    		var formFile = new FormData();
    		if(typeof(fileObj)=='undefined'){
    			window.parent.topMessagePrompt('error','请选择再文件上传');
    			return;
    		}

			formFile.append("myfile", fileObj); //加入文件对象
				$.ajax({
						type: "post",
						url: "Admin/CommonUpload/uploadFile/2",
						data:formFile,
						async: true,
						dataType: "json",
						cache: false, //上传文件无需缓存
						processData: false, //用于对data参数进行序列化处理 这里必须false
						contentType: false, //必须
						success: function(data) {
							if(data.status){
								window.parent.topMessagePrompt('success','上传成功');
							}else{
								window.parent.topMessagePrompt('error','上传失败');
							}
							location.reload();
						}
					});
				}
	</script>
	<style>
		.content{
			margin:100px;
		}
	</style>
	<body>
		<div class="content">
			<input type="file" name="file"  id="document-file" style="margin-bottom: 30px;width: 100%"> 
			<button class="pageItemButton" onclick="upload()"><i class="icon-edit"></i>上传</button>
		</div>
	</body>
	
</html>